import itertools

def quick_sort(l):
    print "call!"
    if len(l) <= 1:
        return l
    else:
        pivo = l[0]
        pivo_pos = 0
        for i in range(1, len(l)):
            if l[i] <= pivo:
                # swap
                tmp = l[i]
                l.remove(tmp)
                l = [tmp] + l
                pivo_pos = pivo_pos+1
        return quick_sort(l[0:pivo_pos+1]) + quick_sort(l[pivo_pos+1:])

l = [4,3,5,6,2,9, 11, 1]
print quick_sort(l)
